/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package workforce.limousine.service;

import java.util.List;
import limousine.vo.Lookup;
import limousine.vo.TransportTariff;
import org.jsrpc.servlet.SessionBean;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.workforce.util.Utils;

/**
 *
 * @author krisada
 */
public class TransportTariffManager extends SessionBean {

    private Service transportTariffService = null;

    public TransportTariffManager() {
    }

    public void init() {
        if (transportTariffService == null) {
            transportTariffService = (Service) WebApplicationContextUtils.getWebApplicationContext(
                    this.getServletContext()).getBean("transportTariffService");
        }
    }

    public boolean remove(String id) {
        init();
        return transportTariffService.remove(id);
    }

    public boolean save(TransportTariff trans) {
        init();
        return transportTariffService.save(trans);
    }
    
    

    public List<Lookup> search(int offset, String token) {
        init();
        List<Lookup> list = transportTariffService.search(offset, new Object[]{token});
        return list;
    }

    public boolean update(TransportTariff trans) {
        init();
        return transportTariffService.update(trans);
    }

    public TransportTariff findById(String id) {
        init();
        return (TransportTariff) transportTariffService.findById(id);
    }

    public boolean removeAll(String ids[]) {
        return false;
    }

    public Service gettransportTariffService() {
        return transportTariffService;
    }

    public void settransportTariffService(Service transportTariffService) {
        this.transportTariffService = transportTariffService;
    }
    
    public String requestId() {
        return Utils.generateId();
    }
}
